package ball;

import javax.swing.*;
import java.awt.*;

public class BallGame extends JFrame {

    Image ball = Toolkit.getDefaultToolkit().getImage("images/ball.png");
    Image desk = Toolkit.getDefaultToolkit().getImage("images/desk.png");

    double x=100;
    double y=100; // 小球的横纵坐标

    //画窗口的方法
    public void paint(Graphics g){
        g.drawImage(desk,0,0,null);
        g.drawImage(ball,(int)x,(int)y,null);
    }

    // 窗口加载
    void launchFragme(){
        setSize(856,500);
        setLocation(50,50);
        setVisible(true);
    }
    public static void main(String[] args){
        BallGame ballGame = new BallGame();
        ballGame.launchFragme();

    }
}
